package com.verisette.ncos.service.master.bizunit;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;

import org.corp.agi.common.exception.ProcessException;
import org.corp.agi.service.bean.ProcessContext;
import org.corp.agi.service.bizunit.CommonBusinessUnit;
import com.verisette.ncos.persistence.dao.RoleManagementDAO;
import com.verisette.ncos.persistence.domain.MasterUserGroup;

/**
 * 
 * {Description here}
 *
 * @author Ratapong Wongpiang (Earth)
 * @since Jul 1, 2010 11:28:43 AM
 * @see
 */
public class InquiryUserGroupBU extends CommonBusinessUnit {

	private Logger logger = Logger.getLogger(InquiryUserGroupBU.class);
	
	private RoleManagementDAO roleManagementDAO;
	@Required
	@Autowired
	public void setRoleManagementDAO(RoleManagementDAO roleManagementDAO) {
		this.roleManagementDAO = roleManagementDAO;
	}
	
	@Override
	public void execute(ProcessContext processContext) throws ProcessException {
		
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": execute" );
		
		// Inquiry UserGroup in MASTER_USER_GROUP
		logger.debug("1.Inquiry UserProfile in MASTER_USER_GROUP.");
		
		MasterUserGroup userGroup = (MasterUserGroup)processContext.getValueObject();
		List<MasterUserGroup> userGroupList = roleManagementDAO.inquiryUserGroup(userGroup, processContext.getPaging());
		
		logger.debug("--> criteria : " + userGroup.getUsgName());
		logger.debug("--> result list size : " + userGroupList.size());
		
		processContext.setValueObject(userGroupList);
		
	}
	
	
}
